<?php
class Purchase extends AppModel {
	var $name = 'Purchase';
	var $displayField = 'id';
	var $validate = array(
		'purchase_amount' => array(
			'numeric' => array(
				'rule' => array('numeric'),
				'message' => 'Solo números',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
                        array(
                            'rule' => array('comparison', '>', 0),
                            'message' => 'Solo valores positivos.'
                        ),
		),
		'article_id' => array(
			'numeric' => array(
				'rule' => array('numeric'),
				'message' => 'Solo números',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
		'supplier_id' => array(
			'numeric' => array(
				'rule' => array('numeric'),
				'message' => 'Solo números',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		),
	);
	//The Associations below have been created with all possible keys, those that are not needed can be removed

	var $belongsTo = array(
		'Article' => array(
			'className' => 'Article',
			'foreignKey' => 'article_id',
			'conditions' => '',
			'fields' => '',
			'order' => ''
		),
		'Supplier' => array(
			'className' => 'Supplier',
			'foreignKey' => 'supplier_id',
			'conditions' => '',
			'fields' => '',
			'order' => ''
		)
	);
}
